<div id="staff">

<script src="/js/plugins/validation/jquery.validate.min.js"></script>
<script src="/js/plugins/validation/additional-methods.min.js"></script>

<script>

    $(document).ready(function() {
        $('.scrollable').slimScroll({
            height: '300px'
        });
    });
</script>


    <div class="box">
        <div class="box-title">
            <h3>
                <i class="icon-table"></i>
                Personal
            </h3>
            <div class="actions">
                <a href="#modal-storeStaff" role="button" class="btn" data-toggle="modal">
                    <button class="btn btn-primary">
                        <i class="icon-plus"></i>
                    </button>
                </a>
            </div>
        </div>
        <div  class="box-content nopadding scrollable" data-height="300">

            <table class="table table-hover table-nomargin table-condensed">
                <thead>
                    <tr>
                        <th>Nombre</th>
                        <th>Cargo</th>
                        <th>&nbsp;</th>
                    </tr>
                </thead>
                <tbody>
                    
                    <?php foreach ($staff as $value) { ?>

                        <tr>
                            <td><?php echo $value['name']; ?></td>
                            <td><?php echo $value['position']; ?></td>
                            <td><a href="#modal-<?php echo $value['id_staff']; ?>" role="button"  data-toggle="modal" >
                                    <button class="btn btn-danger">
                                        <i class="icon-remove"></i>
                                    </button>
                                </a></td>
                        </tr>

                    <?php } ?>

                </tbody>
            </table>

            <form action="#" method="POST" class='form-horizontal form-validate' id="storeStaff">
                <input type="hidden" name="id_store" value="<?php echo (($staff[0]['id_store']!='')?$staff[0]['id_store']:$_GET['id']); ?>" />

                <div id="modal-storeStaff" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h3 id="myModalLabel">Agregar Personal Local</h3>
                    </div>
                    <div class="modal-body">

                        <div class="control-group">
                            <label for="textfield" class="control-label">Nombre</label>
                            <div class="controls">
                                <input type="text" name="name" id="name" class="input-xlarge" data-rule-required="true" data-msg-required="Debe Indicar Nombre">
                            </div>
                        </div>
                        <div class="control-group">
                            <label for="textfield" class="control-label">Cargo</label>
                            <div class="controls">
                                <input type="text" name="position" id="position" class="input-xlarge"  data-rule-required="true" data-msg-required="Debe Indicar Cargo">
                            </div>
                        </div>

                    </div>
                    <div class="modal-footer">
                        <input type="button" class="btn btn-primary" value="Submit" onclick="if ($('#storeStaff').valid()){addStoreStaff();}">
                    </div>
                </div>
            </form>
            
            <?php foreach ($staff as $value) { ?>
                <div id="modal-<?php echo $value['id_staff']; ?>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h3 id="myModalLabel">Eliminar <?php echo $value['name']; ?> ?</h3>
                    </div>
                    <div class="modal-body">
                        <p>Esta seguro de Eliminar <b><?php echo $value['name']; ?>, <?php echo $value['position']; ?></b>? </p>
                    </div>
                    <div class="modal-footer">
                        <button class="btn" data-dismiss="modal" aria-hidden="true">No</button>
                        <button class="btn btn-primary" data-dismiss="modal" onclick="deleteStaff(<?php echo $value['id_staff']; ?>,<?php echo $value['id_store']; ?>)">Si</button>
                    </div>
                </div>
            <?php } ?>
        </div>
    </div>
</div>